﻿using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;

namespace iHouse.Web.Infrastructure
{
    public static class ApiRoutes
    {
        public static void RegisterRoutes(HttpConfiguration config)
        {
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{category}/{page}",
                defaults: new { controller = "BookApi", action = "GetAll", category = RouteParameter.Optional, page = 1 }
            );

            config.Formatters.Remove(config.Formatters.XmlFormatter);
        }
    }
}